<include file="public@header" />
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a>店铺商品订单列表</a></li>
		</ul>

		<form class="well form-inline margin-top-20" method="post" action="{:url('Goodsorder/index')}">

			订单状态：
            <select class="form-control" name="status">
				<option value="">默认</option>
                <volist name="status" id="v">
                    <option value="{$key}" <if condition="input('request.status') neq '' && input('request.status') eq $key">selected</if>>{$v}</option>
                </volist>
			</select>
            订单类型：
            <select class="form-control" name="type">
				<option value="">默认</option>
				<option value="0" <if condition="input('request.type') neq '' && input('request.type') eq 0">selected</if>>店铺自营</option>
				<option value="1" <if condition="input('request.type') neq '' && input('request.type') eq 1">selected</if>>卖家发布</option>
			</select>

		分享佣金：
            <select class="form-control" name="share_income">
				<option value="">全部</option>
				<option value="0" <if condition="input('request.share_income') neq '' && input('request.share_income') eq 0">selected</if>>无佣金</option>
				<option value="1" <if condition="input('request.share_income') neq '' && input('request.share_income') eq 1">selected</if>>有佣金</option>
			</select>
			
            商品名称：
            <input class="form-control" type="text" name="goods_name" style="width: 200px;" value="{:input('request.goods_name')}"
                   placeholder="请输入商品全部或部分名称">
            买家用户ID：
            <input class="form-control" type="text" name="buyer_uid" style="width: 200px;" value="{:input('request.buyer_uid')}"
                   placeholder="请输入买家用户ID、靓号">

            卖家用户ID：
            <input class="form-control" type="text" name="seller_uid" style="width: 200px;" value="{:input('request.seller_uid')}"
                   placeholder="请输入卖家用户ID、靓号">

            订单提交时间：
			<input class="form-control js-bootstrap-date" name="start_time" id="start_time" autocomplete="off" value="{:input('request.start_time')}" aria-invalid="false" style="width: 110px;"> - 
            <input class="form-control js-bootstrap-date" name="end_time" id="end_time" autocomplete="off" value="{:input('request.end_time')}" aria-invalid="false" style="width: 110px;">
            
            订单编号：
            <input class="form-control" type="text" name="orderno" style="width: 200px;" value="{:input('request.orderno')}"
                   placeholder="请输入全部或部分订单编号">
            三方支付订单号：
            <input class="form-control" type="text" name="trade_no" style="width: 200px;" value="{:input('request.trade_no')}"
                   placeholder="请输入三方支付订单号">

            联系电话：
            <input class="form-control" type="text" name="phone" style="width: 200px;" value="{:input('request.phone')}"
                   placeholder="请输入购买者用户的电话号码">
            
			<input type="submit" class="btn btn-primary" value="搜索">
			<a class="btn btn-danger" href="{:url('Goodsorder/index')}">清空</a>
		</form>

		<form method="post" class="js-ajax-form">
			<table class="table table-hover table-bordered">
				<thead id="bignav">
					<tr>
						<th>ID</th>
						<th>购买用户</th>
						<th>商家</th>
						<th>订单编号</th>
						<th>商品名称</th>
						<th>商品规格</th>
						<th>规格封面</th>
						<th>购买数量</th>
						<th>商品单价</th>
						<th>商品运费</th>
						<th>商品总价</th>
						<th>购买者</th>
						<th>购买者电话</th>
						<th>支付方式</th>
						<th>三方订单号</th>
						<th>订单状态</th>
						<th>下单时间</th>
						<th>取消时间</th>
						<th>付款时间</th>
						<th>发货时间</th>
						<th>收货时间</th>
						<th>评价时间</th>
						<th>结算时间</th>
						<th>分享用户</th>
						<th>分享佣金</th>
						<th align="center">{:lang('ACTIONS')}</th>
					</tr>
				</thead>
				<tbody>
					<foreach name="lists" item="vo">
					<tr>
						<td>{$vo.id}</td>
						<td>{$vo.buyer_info['user_nickname']}({$vo['uid']})</td>
						<td><if condition="$vo['shop_uid'] eq 1">店铺自营<else />{$vo.seller_info['user_nickname']}({$vo['shop_uid']})</if></td>
						<td>{$vo['orderno']}</td>
						<td style="min-width: 100px;">{$vo['goods_name']}</td>
						<td>{$vo['spec_name']}</td>
						<td><img width="40" height="40" class="imgtip" src="{$vo['spec_thumb']}" /></td>
						<td>{$vo['nums']}</td>
						<td>￥{$vo['price']}</td>
						<td>￥{$vo['postage']}</td>
						<td>￥{$vo['total']}</td>
						<td>{$vo['username']}</td>
						<td>{$vo['phone']}</td>
						<td>{$type[$vo['type']]}</td>
						<td>{$vo['trade_no']}</td>
						<td>{$status[$vo['status']]}</td>
						<td>{:date('Y-m-d H:i',$vo['addtime'])}</td>
						<td><if condition="$vo['cancel_time'] gt 0">{:date('Y-m-d H:i',$vo['cancel_time'])}<else />--</if></td>
						<td><if condition="$vo['paytime'] gt 0">{:date('Y-m-d H:i',$vo['paytime'])}<else />--</if></td>
						<td><if condition="$vo['shipment_time'] gt 0">{:date('Y-m-d H:i',$vo['shipment_time'])}<else />--</if></td>
						<td><if condition="$vo['receive_time'] gt 0">{:date('Y-m-d H:i',$vo['receive_time'])}<else />--</if></td>
						<td><if condition="$vo['evaluate_time'] gt 0">{:date('Y-m-d H:i',$vo['evaluate_time'])}<else />--</if></td>
						<td><if condition="$vo['settlement_time'] gt 0">{:date('Y-m-d H:i',$vo['settlement_time'])}<else />--</if></td>
						<td><if condition="$vo['shareuid'] gt 0">{$vo['share_info']['user_nickname']}({$vo['shareuid']})<else />--</if></td>
						<td>￥{$vo['share_income']}</td>
						
						<td>
                            <if condition="$vo['shop_uid'] eq 1 && $vo['status'] eq 1">
                            	<a class="btn btn-xs btn-primary" href='{:url("Goodsorder/setexpress",array("id"=>$vo["id"]))}'>填写物流</a>
                            </if>
                            
                            <if condition="$vo['shipment_time'] gt 0">
                            	<a class="btn btn-xs btn-primary" onclick="express({$vo['id']})">物流信息</a>
                            </if>
                            <a class="btn btn-xs btn-primary" href='{:url("Goodsorder/info",array("id"=>$vo["id"]))}'>详情</a>
							
						</td>
					</tr>
					</foreach>
				</tbody>
			</table>
			<div class="pagination">{$page}</div>
		</form>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
	<script type="text/javascript">
		$(function(){
			Wind.use('layer');
		});

		function express(orderid){
			layer.open({
			  type: 2,
			  title: '物流信息',
			  shadeClose: true,
			  shade: 0.8,
			  area: ['500px', '90%'],
			  content: '/appapi/Express/index?user_type=platform&orderid='+orderid //iframe的url
			}); 
		}
	</script>

	
</body>
</html>